package com.msg.test.model;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;

/**
 * Created by Administrator on 2017/10/20 0020.
 */
public class MsgDeliverResp extends MsgHead{
    private static Log log = LogFactory.getLog(MsgDeliverResp.class);
    private long msg_Id;
    private int result;
    public byte[] toByteArray(){
        ByteArrayOutputStream bous = new ByteArrayOutputStream();
        DataOutputStream dous = new DataOutputStream(bous);
        try {
            dous.writeInt(this.getTotalLength());
            dous.writeInt(this.getCommandId());
            dous.writeInt(this.getSequence());
            dous.writeLong(this.msg_Id);
            dous.writeInt(this.result);
            dous.close();
        } catch (IOException e) {
            log.error("封装链接二进制数组失败");
        }
        return bous.toByteArray();
    }

    public long getMsg_Id() {
        return msg_Id;
    }

    public void setMsg_Id(long msg_Id) {
        this.msg_Id = msg_Id;
    }

    public int getResult() {
        return result;
    }

    public void setResult(int result) {
        this.result = result;
    }
}
